package ui.activity.order.presenter;


import javax.inject.Inject;

import Bean.OrderDetailsNewBean;
import base.BaseBiz;
import ui.activity.order.biz.OrderDetailsBiz;
import ui.activity.order.contract.OrderDetailsContract;

/**
 * Created by chenjian on 19/2/26
 */

public class OrderDetailsPresenter implements OrderDetailsContract.Presenter {

    OrderDetailsContract.View view;
    OrderDetailsBiz orderDetailsBiz;


    @Inject
    public OrderDetailsPresenter(OrderDetailsContract.View view) {
        this.view = view;
    }


    @Override
    public void setBiz(BaseBiz biz) {
        orderDetailsBiz = (OrderDetailsBiz) biz;
    }


    @Override
    public void getOrderInfo(String orderId) {
        view.loading(true);
        orderDetailsBiz.getOrderInfo(orderId, new BaseBiz.Callback<OrderDetailsNewBean>() {
            @Override
            public void onSuccess(OrderDetailsNewBean info) {
                view.upDateSnList(info.getPosOrderShipVOList());
                view.upDateUI(info);
                view.loading(false);
            }

            @Override
            public void onFailure(OrderDetailsNewBean info) {
                view.loading(false);
            }
        });
    }

    @Override
    public void getSnList(String orderId) {
//        orderDetailsBiz.queryOrderSnList(orderId, new BaseBiz.Callback<List<OrderSn>>() {
//            @Override
//            public void onSuccess(List<OrderSn> info) {
//                view.upDateSnList(info);
//            }
//
//            @Override
//            public void onFailure(List<OrderSn> info) {
//                view.loading(false);
//            }
//        });
    }


}
